package com.yida.gwj.expend.outside.service;

import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;

import com.yida.gwj.expend.outside.domain.GwjMaintenanceFundsBusinessAttachment;
import com.yida.gwj.expend.outside.domain.dto.GetAttachmentInfoRequest;
import com.yida.gwj.expend.outside.domain.request.InsertAttachmentInfoRequest;
import com.yida.gwj.expend.outside.enums.BusinessAttachmentServerTypeEnum;

/**
 * 上传材料图片地址Service接口
 *
 * @author lgp
 * @date 2023-03-21
 */
public interface IGwjMaintenanceFundsBusinessAttachmentService {
    /**
     * 查询上传材料图片地址
     *
     * @param attachmentId 上传材料图片地址主键
     * @return 上传材料图片地址
     */
    GwjMaintenanceFundsBusinessAttachment selectGwjMaintenanceFundsBusinessAttachmentByAttachmentId(Long attachmentId);

    /**
     * 查询上传材料图片地址列表
     *
     * @param gwjMaintenanceFundsBusinessAttachment 上传材料图片地址
     * @return 上传材料图片地址集合
     */
    List<GwjMaintenanceFundsBusinessAttachment> selectGwjMaintenanceFundsBusinessAttachmentList(GwjMaintenanceFundsBusinessAttachment gwjMaintenanceFundsBusinessAttachment);

    /**
     * 查询上传材料图片地址列表,不调用文件服务器
     *
     * @param gwjMaintenanceFundsBusinessAttachment 上传材料图片地址
     * @return 上传材料图片地址集合
     */
    List<GwjMaintenanceFundsBusinessAttachment> selectGwjMaintenanceFundsBusinessAttachmentListNoFileService(GwjMaintenanceFundsBusinessAttachment gwjMaintenanceFundsBusinessAttachment);

    /**
     * 新增上传材料图片地址
     *
     * @param gwjMaintenanceFundsBusinessAttachment 上传材料图片地址
     * @return 结果
     */
    int insertGwjMaintenanceFundsBusinessAttachment(GwjMaintenanceFundsBusinessAttachment gwjMaintenanceFundsBusinessAttachment);

    /**
     * 修改上传材料图片地址
     *
     * @param gwjMaintenanceFundsBusinessAttachment 上传材料图片地址
     * @return 结果
     */
    int updateGwjMaintenanceFundsBusinessAttachment(GwjMaintenanceFundsBusinessAttachment gwjMaintenanceFundsBusinessAttachment);

    /**
     * 批量删除上传材料图片地址
     *
     * @param attachmentIds 需要删除的上传材料图片地址主键集合
     * @return 结果
     */
    int deleteGwjMaintenanceFundsBusinessAttachmentByAttachmentIds(Long[] attachmentIds);

    /**
     * 删除上传材料图片地址信息
     *
     * @param attachmentId 上传材料图片地址主键
     * @return 结果
     */
    int deleteGwjMaintenanceFundsBusinessAttachmentByAttachmentId(Long attachmentId);

    /**
     * 查询上传材料图片地址列表
     *
     * @param getAttachmentInfoRequest 上传材料图片地址
     * @return 上传材料图片地址集合
     */
    List<GwjMaintenanceFundsBusinessAttachment> getGwjMaintenanceFundsBusinessAttachmentList(GetAttachmentInfoRequest getAttachmentInfoRequest);

    /**
     * 新增上传材料图片地址
     *
     * @param insertAttachmentInfoRequest 上传材料图片地址
     * @return 结果
     */
    Long insertAttachmentInfo(InsertAttachmentInfoRequest insertAttachmentInfoRequest);

    /**
     * 删除gwj维修基金业务附件服务器识别
     *
     * @param serverIdentification 服务器标识
     * @return int
     */
    int deleteGwjMaintenanceFundsBusinessAttachmentByServerIdentification(String serverIdentification);

    /**
     * 批量新增上传材料图片地址
     *
     * @param maintenanceFundsBusinessAttachmentList
     * @return int 影响行数
     */
    int insertBatchAttachment(List<GwjMaintenanceFundsBusinessAttachment> maintenanceFundsBusinessAttachmentList);

    /**
     * 查询上传材料图片地址
     *
     * @param maintenanceFundsBusinessAttachment
     * @return 上传材料图片地址
     */
    GwjMaintenanceFundsBusinessAttachment getGwjMaintenanceFundsBusinessAttachment(GwjMaintenanceFundsBusinessAttachment maintenanceFundsBusinessAttachment);

    /**
     * 检查空
     *
     * @param serverType 服务器类型
     * @param receiveFlag 类型 是否收件 先对传进来的数据进行匹配,如果有的匹配不上,则直接return,不进行是否收件判断
     * @param getAttachmentList 得到附件列表
     * @return {@link List}<{@link BusinessAttachmentServerTypeEnum}> 需要判断的附件类型
     */
    List<BusinessAttachmentServerTypeEnum> checkNull(Supplier<Optional<List<GwjMaintenanceFundsBusinessAttachment>>> getAttachmentList, boolean receiveFlag, List<BusinessAttachmentServerTypeEnum> serverType);

    /**
     * 通过字段转换得到content实体
     *
     * @param t t
     * @param fieldName 字段名
     * @param serverType 服务器类型
     * @param serverIdentification 服务器标识
     * @return {@link T}
     */
    <T> T getContent2Entity(Class<T> t, Integer serverType, String serverIdentification, String... fieldName);

    /**
     * 多附件材料上传
     *
     * @param insertAttachmentInfoRequestList 上传材料图片地址
     * @return 结果
     */
    int batchInsertAttachmentInfo(List<InsertAttachmentInfoRequest> insertAttachmentInfoRequestList);
}
